/**
 * Copyright 2009-2011 xiaonei.com All right reserved.
 * This software is the confidential and proprietary information of Xiaonei.com ("Confidential Information"). 
 * You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement you entered into with Xiaonei.com.
 * Create by XiaoNeiAntiSpamTeam
 *
 */

package com.xiaonei.testice.util;

import Ice.InitializationData;

/**
 * @ClassName: IceUtil
 * @Description: ice工具类
 * @author shaohui.liu shaohui.liu@opi-corp.com
 * @date Feb 1, 2010 6:11:54 PM
 * 
 */
public class IceUtil {

    /**
     * 
     * @Title: initData
     * @Description: 初始化ICE参数
     * @param @return
     * @return InitializationData
     * @throws
     */
    public static InitializationData initData() {
        Ice.Properties properties = Ice.Util.createProperties();
        properties.setProperty("Ice.Override.Timeout", "500");
        properties.setProperty("Ice.Override.ConnectTimeout", "300");
        properties.setProperty("IceGrid.InstanceName", "XiaoNeiAntiSpam");
        properties.setProperty("Ice.ThreadPool.Client.StackSize", "65535");
        properties.setProperty("Ice.ThreadPool.Client.StackSize", "65535");
        properties.setProperty("Ice.Default.Locator",
                "XiaoNeiAntiSpam/Locator:default -h  10.3.16.98 -p 4061");
        Ice.InitializationData initData = new InitializationData();
        initData.properties = properties;
        return initData;
    }

    /**
     * @Title: initData
     * @Description: 初始化ICE参数
     * @param @param timeout 调用超时时间
     * @param @param connectTimeout 连接超时时间
     * @param @return
     * @return InitializationData
     * @throws
     */
    public static InitializationData initData(int timeout, int connectTimeout) {
        Ice.Properties properties = Ice.Util.createProperties();
        properties.setProperty("Ice.Override.Timeout", Integer.toString(timeout));
        properties.setProperty("Ice.Override.ConnectTimeout", Integer.toString(connectTimeout));
        properties.setProperty("IceGrid.InstanceName", "XiaoNeiAntiSpam");
        properties.setProperty("Ice.ThreadPool.Client.StackSize", "65535");
        properties.setProperty("Ice.ThreadPool.Client.StackSize", "65535");
        properties.setProperty("Ice.Default.Locator",
                "XiaoNeiAntiSpam/Locator:default -h 10.3.16.98 -p 4061");
        Ice.InitializationData initData = new InitializationData();
        initData.properties = properties;
        return initData;
    }
}
